#!/bin/bash
# Zaitan Module - Virtual Box Install
# Zaitan Team <http://code.google.com/p/zaitan/>

RMOD_ENGINE='3.0'
RMOD_CATEGORY='Servidores'
RMOD_SUBCATEGORY='Virtual Machine'
RMOD_NAME='Virtual Box'
RMOD_AUTHOR='Zaitan Team'
RMOD_VERSION='1.5.2'
RMOD_DESCRIPTION='Installs Virtual Box'


# Install Virtual Box


echo Running $RMOD_NAME...
#/usr/lib/zaitan/modulo/mod-checkInstall
usuario="$USER"
usermod -G vboxusers -a "$usuario"

echo 'deb http://www.virtualbox.org/debian gutsy non-free #VBOX' | tee -a /etc/apt/sources.list


wget -q http://www.virtualbox.org/debian/innotek.asc -O- | apt-key add -

apt-get update
apt-get -y install virtualbox

sed -i -e '/VBOX/D' /etc/apt/sources.list
sed -i -e 's/MODE="0664"/MODE="0666"/g' /etc/udev/rules.d/40-permissions.rules

chmod 666 /dev/vboxdrv
echo 'KERNEL=="vboxdrv", GROUP="vboxusers", MODE="0666"' | tee -a /etc/udev/rules.d/40-permissions.rules

apt-get update

echo $RMOD_NAME Finibashed...

##Logs
echo $RMOD_NAME-$RMOD_VERSION | tee -a /usr/share/zaitan/logs
/usr/lib/zaitan/modulo/mod-logs
##

exit 0

